using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace LongBV.QLNS.Report
{
    public partial class frm_InDanhSachAllNhanVien : DevComponents.DotNetBar.Office2007Form
    {
        public frm_InDanhSachAllNhanVien()
        {
            InitializeComponent();
        }
        LongBV.QLNS.Report.InDanhSachNhanAllNhanVien report = new LongBV.QLNS.Report.InDanhSachNhanAllNhanVien();
        private void frm_InDanhSachAllNhanVien_Load(object sender, EventArgs e)
        {
            DataService dt = new DataService();
            Connect();
        }
        private void Connect()
        {
            CrystalDecisions.Shared.TableLogOnInfo tliCurrent = new CrystalDecisions.Shared.TableLogOnInfo();
            foreach (CrystalDecisions.CrystalReports.Engine.Table tbCurrent in report.Database.Tables)
            {
                tliCurrent = tbCurrent.LogOnInfo;
                tliCurrent.ConnectionInfo.ServerName = LongBV.QLNS.Properties.Settings.Default.servername;
                tliCurrent.ConnectionInfo.UserID = LongBV.QLNS.Properties.Settings.Default.username;
                tliCurrent.ConnectionInfo.Password = LongBV.QLNS.Properties.Settings.Default.pass;
                tliCurrent.ConnectionInfo.DatabaseName = LongBV.QLNS.Properties.Settings.Default.databasename;
                tbCurrent.ApplyLogOnInfo(tliCurrent);
            }
            report.SetParameterValue(0, LongBV.QLNS.Properties.Settings.Default.OrganizationName);
            report.SetParameterValue(1, LongBV.QLNS.Properties.Settings.Default.Address);
            report.SetParameterValue(2, LongBV.QLNS.Properties.Settings.Default.Telephone);
            report.SetParameterValue(3, string.IsNullOrEmpty(LongBV.QLNS.Properties.Settings.Default.Fax) ? "FAX: " : LongBV.QLNS.Properties.Settings.Default.Fax);
            crystalReportViewer1.ReportSource = report;
            crystalReportViewer1.Refresh();
        }
    }
}